package com.tshopping.dao;

import com.tshopping.bean.Parameter;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface ParameterDao {

    @Insert("insert into goods_parameter(stock,specification,goods,color) values(#{stock},#{specification},#{goods},#{color})")
    boolean insertParameterByParameterInformation(@Param("stock") int stock, @Param("specification") String specification, @Param("goods") int goods, @Param("color") String color);

    @Select("select * from goods_parameter where goods =#{goods}")
    ArrayList<Parameter> selectParametersByGoodsId(@Param("goods") int goods);

    @Select("select * from goods_parameter where id=#{id}")
    Parameter selectParameterById(@Param("id")int id);

    @Update("update goods_parameter set stock=#{stock},specification=#{specification},color=#{color} where id=#{id}")
    boolean updateGoodsParameterByParameterId(@Param("stock") int stock, @Param("specification") String specification, @Param("color") String color, @Param("id") int id);

    @Delete("delete from goods_parameter where id=#{id}")
    boolean deleteParameterByParameterId(@Param("id") int id);

    @Delete("delete from goods_parameter where goods=#{goods}")
    boolean deleteParameterByGoodsId(@Param("goods") int goods);
}
